<?php
class Tag extends Doctrine_Record {
    public function setTableDefinition() {
        $this->setTableName('tag');
        $this->hasColumn('id', 'integer', 3, array('primary' => true, 'unsigned'=>true, 'autoincrement'=>true));
        $this->hasColumn('value', 'string', 255);
    }
    
    public function setUp(){
        $this->hasMany('Publicacion as publicaciones', array(
            'local' => 'id_tag',
            'foreign' => 'id_publicacion',
            'refClass' => 'Tagging'
        ));
        $this->hasMany('Visita as visitas', array(
            'local' => 'id',
            'foreign' => 'id_tag'
        ));
       //behaviors
        $this->actAs('Sluggable', array('fields'=>array('value'),'unique'=>true,'canUpdate'=>true,'name'=>'slug'));
    }

}
?>